package week_01.arr;

import java.io.*;
import java.util.Arrays;

public class bubble_sort {
    public static void main(String[] args) throws

            IOException {
        String pathName = "src\\week_01\\arr\\1w random number.txt";
        FileReader fileReader = new FileReader(pathName);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        String textLine = "";
        String str = "";
        while ((textLine = bufferedReader.readLine()) != null) {
            str += textLine;
        }
        Integer[] a = new Integer[10000];
        Integer[] b = new Integer[100];
        String[] arr = str.split(",");
        for (int i = 0; i < b.length; i++) {
            b[i] = Integer.parseInt(arr[i]);
        }
        for (int i = 0; i < a.length; i++) {
            a[i] = Integer.parseInt(arr[i]);
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[i]) {
                    int temp;
                    temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[i]) {
                    int temp;
                    temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(a));
        System.out.println(Arrays.toString(b));
    }

}
